implementation from NAND gate only